#ifndef __CANInit_H

#define __CANInit_H
#include "gd32e10x.h"
#include "gd32e10x_can.h"
void gd_CANxGPIO_init(uint32_t CANx);
void CANx_Config(uint32_t CANx,uint32_t CANbaudrate,uint32_t CANFDbaudrate,ControlStatus CANFD);

void InitCAN0(void);
void InitCAN1(void);
void InitCANConfig(void);
void GaoZhi_can_filter_mask_mode_init(uint32_t id, uint32_t mask, uint8_t format_fifo, uint16_t filter_number,uint8_t CAN_filtermode);
uint16_t Twobytesto16(uint8_t *pDa);//取两个字节
uint32_t Fourbytesto32(uint8_t *pDa);//取4个字节
void InitCANx(uint32_t CANx,uint32_t CANbaudrate,uint32_t CANFDbaudrate,ControlStatus CANFD);//初始化CAN
/*
CAN 唤醒
*/
void CAN_Wakeup(u32 CANx);
/*
CAN 休眠
*/
void CAN_Sleep(u32 CANx);
void CAN_poweron(u32 CANx);
void CAN_poweroff(u32 CANx);
	
typedef struct FunAble0
{
	u8 Brand    :1;//品牌
	u8 Model    :1;//车型
	u8 Date     :1;//制造日期
	u8 VIN      :1;//vin
	u8 reserve  :4;//预留
	
	
}FunAble0;
typedef struct FunAble1
{
	u8 Doors     :1;//车门
	u8 Windows   :1;//车窗
	u8 Basic     :1;//基本状态(锁车 点火 ACC ill break)
	u8 Handbrake :1;//手刹
	u8 OutLamp   :1;//车外灯
	u8 InLamp    :1;//车内灯
	u8 LampBrigh :1;//仪表背光亮度
	u8 Gear      :1;//档位
	
}FunAble1;
typedef struct FunAble2
{
	u8 Speed    :1;//车速
	u8 Engine   :1;//发动机转速
	u8 BATVol   :1;//电池电压
	u8 CoolTemp :1;//冷却液温度
	u8 FuelLoss :1;//燃油消耗
	u8 atmos    :1;//大气压力
	u8 Throttle :1;//节气门
	u8 TurnLemp :1;//转向灯


}FunAble2;
typedef struct FunAble3
{
	u8 wheel        :1;//方向盘转速
	u8 R_gear       :1;//R档位
	u8 lau_alarm    :1;//设备启动提醒
	u8 brake_alarm  :1;//手刹未放下提醒
	u8 belt_alarm   :1;//安全带提醒
	u8 tire_v_alarm :1;//胎压提醒
	u8 reserve      :2;//预留
}FunAble3;
typedef struct FunAble4
{
	u8  DTC     :1;//故障码
	u8 reserve  :7;//预留
}FunAble4;
typedef struct FunAble5
{
	u8 Odo       :1;//里程
	u8 Fuel      :1;//油量
	u8 Endurance :1;//续航里程
	u8 Trip      :1;//小计里程
	u8 RunTrip   :1;//启动后里程
	u8 Electricity :1;//电量
	u8 reserve   :2;//预留
}FunAble5;
typedef struct FunAble6
{
	u8 LFLock  :1;//左前车锁
	u8 RFLock  :1;//右前车锁
	u8 LRLock  :1;//左后车锁
	u8 RRLock  :1;//右后车锁
	u8 OutLock :1;//遥控外侧锁车
	u8 Inlock  :1;//车内中控锁
	u8 reserve :2;//预留
}FunAble6;
typedef struct FunAble7
{
	u8 LFbelt : 1;//左前安全带
	u8 RFbelt : 1;//右前安全带
	u8 LRbelt : 1;//左前安全带
	u8 RRbelt : 1;//右前安全带
	u8 RCbelt : 1;//后中安全带
	u8 reserve :3;//预留
}FunAble7;
typedef struct FunAble8
{
	u8 lock :1;//锁车
	u8 Igst :1;//点火
	u8 Acc  :1;//Acc状态
	u8 ILL  :1;//ILL
	u8 Break:1;//脚刹
	u8 On   :1;//ON状态
	u8 reserve :3;//预留
}FunAble8;
typedef struct FunAble9
{
	u8 StaVol          :1;//静态电压
	u8 DynVol          :1;//动态电压
	u8 ThrottleVol     :1;//节气门电压
	u8 AcceleratorVol  :1;//加速踏板电压
	u8 injection_pulse :1;//喷油脉宽
	u8 Supply_pressure :1;//供油压力
	u8 Intake_pressure :1;//进气压力
	u8 Intake_air_temp :1;//进气温度
}FunAble9;
typedef struct FunAble10
{
	u8 watertemp           :1;//水温
	u8 Front_oxygen_sensor :1;//前氧传感器
	u8 Rear_oxygen_sensor  :1;//后氧传感器
	u8 injection_quantity  :1;//喷油量
	u8 injection_time      :1;//喷油时间
	u8 TPMS                :1;//胎压
	u8 cover               :1;//前机舱盖
	u8 trunk               :1;//后备箱
	
}FunAble10;
typedef struct FunAble11
{
	u8 reserve :8;//预留
}FunAble11;
void can_filter_list_mode_init(uint32_t id, uint32_t mask, can_format_fifo_enum format_fifo, uint16_t filter_number);
#endif
